﻿/*
 * 关系运算符
 * 
 *          判断两个数据之间大/小/相等之类的关系，返回值为bool类型，true或者false
 */
namespace 关系运算符与逻辑运算符
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("-----------关系运算符----------------");
            int a = 10, b = 20;

            Console.WriteLine("a == b :" + (a == b));
            Console.WriteLine("a != b :" + (a != b));
            Console.WriteLine("a < b :" + (a < b));
            Console.WriteLine("a > b :" + (a > b));
            Console.WriteLine("a <= b :" + (a <= b));
            Console.WriteLine("a >= b :" + (a >= b));
            

            Console.WriteLine("-----------逻辑运算符----------------");
            int cm = 18;

            Console.WriteLine("cm > 10 & cm < 12:" + (cm > 10 & cm < 12));
            Console.WriteLine("cm > 10 & cm < 12" + (cm > 10 & cm < 12));
            Console.WriteLine("!(cm > 20) " + !(cm > 20));
            Console.WriteLine("cm > 12 ^ cm < 10:" + (cm > 12 ^ cm < 10));

            //当前的数字，大于0，小于10，且是偶数
            int c = 6;

            int yushu = c % 2;

            Console.WriteLine("题目输出：" + (c > 0 & c < 10 & yushu == 0));

            int d = 5;

            //Console.WriteLine(d > 8 & ++d < 8);
            //Console.WriteLine("d = " + d);

            //Console.WriteLine(d > 8 && ++d < 8);
            //Console.WriteLine("d = " + d);

            //Console.WriteLine(d > 8 | ++d < 8);
            //Console.WriteLine("d = " + d);

            Console.WriteLine(d < 8 || ++d < 8);
            Console.WriteLine("d = " + d);

            
            
        }
    }
}